package com.tedu.controller;

import com.tedu.pojo.Car;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/car")
public class CarController3 {
    @RequestMapping("/add")
    public void add(Integer id,String name) {
        System.out.println(id+name);
    }
    @RequestMapping("/insert1")
    public  void  insert1 (Car c){//封装成对象，各种参数都可以传
        System.out.println(c);
    }
    @RequestMapping("/insert2/{id}/{name}")
    public void insert2(@PathVariable Integer id,@PathVariable String name){//每个参数都要加@PathVariable
        System.out.println(id+name);
    }
}
